<template>
    <el-container>
      <el-main>
        <div style="height: 405px;display:flex;flex-direction:column;justify-content:center;align-items: center;">
            <div class="amount">充值300</div>
            <sa-image url="https://liuliangbenben.oss-cn-hangzhou.aliyuncs.com/storage/default/202503131953101765.png"  size="200" />
        </div>
      </el-main>
      <el-footer class="sa-footer--submit">
        <el-button
          type="primary"
          @click="confirm"
          >确定</el-button
        >
      </el-footer>
    </el-container>
  </template>
  <script setup>
    import { nextTick, onMounted, reactive, ref, unref } from 'vue';
    import { api } from '../earning.service';
    import { cloneDeep } from 'lodash';
   
   
    const emit = defineEmits(['modalCallBack']);

    const props = defineProps({
      modal: {
        type: Object,
      },
    });

    // 添加 编辑 form
    let formRef = ref(null);

    const form = reactive({
      model: {
        one: '',
        two: '',
        three: '',
        four: '',
        five: '',
        six: '',
      },
      rules: {
        amount: [{ required: true, message: '请输入提现金额', trigger: 'blur' }],
      },
    });

    const loading = ref(false);

    // 获取详情
    async function getDetail(id) {
      loading.value = true;
      const { error, data } = await api.questionCategory.detail(id);
      if(error==0){
        form.model = data;
       
      }
  
      loading.value = false;
    }

    // 表单关闭时提交
    async function confirm() {
      // 表单验证
      unref(formRef).validate(async (valid) => {
        if (!valid) return;
        let submitForm = cloneDeep(form.model);
        const { error } =
          props.modal.params.type == 'add'
            ? await api.questionCategory.add(submitForm)
            : await api.questionCategory.edit(props.modal.params.id, submitForm);
        if (error == 0) {
          emit('modalCallBack', { event: 'confirm' });
        }
      });
    }



    onMounted(() => {
     
    });
  </script>
  <style lang="scss" scoped>
    .pay{
        width:100px;
        height:100px;
    }
    .amount{
      
      height: 18px;
      font-family: SourceHanSansCN, SourceHanSansCN;
      font-weight: bold;
      font-size: 18px;
      color: #2E2E2E;
      line-height: 27px;
      text-align: center;
      font-style: normal;
      margin-bottom: 20px;
    }
  </style> 
